package com.zzh.server.pojo;
/*
 * @Auther : wenrouyue
 * @Date : 2022/4/8-0:15
 */

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.format.annotation.NumberFormat;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Slf4j
public class baseBean {
    private long code;
    private String message;
    private Object data;

    /**
     * 成功返回
     *
     * @param message
     * @return
     */
    public static baseBean success(String message) {
        log.info("success==>" + message);
        return new baseBean(200, message, null);
    }

    public static baseBean success(String message, Object obj) {
        log.info("success==>" + message + "data==>"+obj);
        return new baseBean(200, message, obj);
    }

    /**
     * 失败返回
     *
     * @param message
     * @return
     */
    public static baseBean error(String message) {
        log.info("success==>" + message);
        return new baseBean(500, message, null);
    }

    public static baseBean error(String message, Object obj) {
        log.info("success==>" + message + "data==>"+obj);
        return new baseBean(500, message, obj);
    }

}
